package com.car.loan.project.xr.util.vo.report;

import com.car.loan.common.utils.StringUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDate;
import lombok.Data;

/**
 * 业务统计
 *
 * @author huangding
 * @date 2020/2/19 11:51
 */
@Data
public class BusinessStatisticsVo {

    @ApiModelProperty("业务编号")
    private String businessNo;

    @ApiModelProperty("客户名称")
    private String customerName;

    @ApiModelProperty("车辆类型")
    private String carType;

    @ApiModelProperty("车辆性质")
    private String carNature;

    @ApiModelProperty("分期金额")
    private Double installmentAmount;

    @ApiModelProperty("合同车价")
    private Double sellAmount;

    @ApiModelProperty("融资金额")
    private Double financingAmount;


    @ApiModelProperty("期数")
    private Integer term;

    @ApiModelProperty("银行名称")
    private String bankName;

    @ApiModelProperty("部门名称")
    private String deptName;

    @ApiModelProperty("业务员")
    private String adminName;

    @ApiModelProperty("合作商户")
    private String dealerName;

    @ApiModelProperty("付款时间")
    private String advanceDate;

    @ApiModelProperty("车系型号")
    private String carName;

    @ApiModelProperty(value = "放贷日期", required = true)
    private String lendDate;

    @ApiModelProperty("合同移交日期")
    private String contractDate;

    @ApiModelProperty("业务提交时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate businessTime;

    @ApiModelProperty("业务审批时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate businessAuditTime;

    @ApiModelProperty("加签审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate businessApostilleTime;

    public String getCarNature() {
        if (StringUtils.isNotEmpty(carNature)) {
            if ("1".equals(carNature)) {
                return "新车";
            } else if ("2".equals(carNature)) {
                return "二手车";
            } else {
                return "存量车";
            }
        }
        return carNature;
    }
}
